import com.itheima.ssm.dao.*;
import com.itheima.ssm.domain.*;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/applicationContext_dao.xml")
public class test {


    @Autowired
    private IProductDao productDao;

@Autowired
    IMemberDao memberDao;
    @Autowired
    private IOderDao oderDao;

@Autowired
private IRoleDao roleDao;


@Autowired
private IPermissionDao permissionDao;
    @Autowired
  private   IUserDao  userDao;
@Test
    public void test1() throws Exception {
  /*  Product byId = productDao.findById("676C5BD1D35E429A8C2E114939C5685A\n");
    System.out.println(byId);*/
    List<Product> all = productDao.findAll();
    System.out.println(all);
}


@Test
    public void test2(){
    Orders orders = oderDao.selectById("0E7231DC797C486290E8713CA3C6ECCC");
    System.out.println(orders);
}


@Test
    public void test3() throws Exception {
    List<Orders> all = oderDao.findAll();
    System.out.println(all);
}

@Test
    public void test5() throws Exception {
    UserInfo tom = userDao.findByName("jack");
    System.out.println(tom);
}



    @Test
    public void test6() throws Exception {
        List<Role> rl = roleDao.findById("u2222");
        System.out.println(rl);
    }

    @Test
    public void test7() throws Exception {
        List<UserInfo> all = userDao.findAll();
        System.out.println(all);
    }

    @Test
    public void test(){
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        String encode = bCryptPasswordEncoder.encode("456");
        System.out.println(encode);
    }

    @Test
    public void test9(){
        UserInfo u1111 = userDao.findById("u1111");
        System.out.println(u1111);
    }

    @Test
    public void test10(){
/*
        List<Permission> byId = permissionDao.findById("2222");
        System.out.println(byId);
*/
userDao.insertUserAndRole("111-222","1111");
      /*  List<Role> u2222 = roleDao.findById("u2222");
        System.out.println(u2222);*/
    }
}
